package com.mop.core.es.dao.dao.impl;


import com.mop.core.es.dao.config.JestConfig;
import io.searchbox.client.JestClient;

import java.util.List;

/**
 * @author lemon
 * @ClassName ElasticSearchDao
 * @desc
 * @Date 2018/12/12 16:38
 * @Version 1.0
 **/
public class ElasticSearchDao extends ElasticSearchDaoImpl {

    private static ElasticSearchDao elasticSearchDao;

    public static ElasticSearchDao getInstance() {
        if (elasticSearchDao == null) {
            synchronized (ElasticSearchDao.class) {
                if (elasticSearchDao == null) {
                    initDefaultElasticSearchDao();
                }
            }
        }
        return elasticSearchDao;
    }

    private static void initDefaultElasticSearchDao() {
        elasticSearchDao = new ElasticSearchDao(JestConfig.getDefaultServerUris());
    }

    private ElasticSearchDao(List serverUris) {
        super(serverUris);
    }
}
